package org.ipower.examsystem.service.impl;

import java.util.List;
import org.ipower.examsystem.dao.CooperationMemberDao;
import org.ipower.examsystem.domain.CooperationMember;
import org.ipower.examsystem.service.CooperationMemberService;
import org.ipower.platform.domain.Pager;
import org.ipower.platform.domain.QueryCondition;

/**
 *合作机构成员服务类。
 * @author jeasonyoung
 */
public class CooperationMemberServiceImpl implements CooperationMemberService {
    private static final long serialVersionUID = 1L;
    private CooperationMemberDao dao = null;
  
    @Override
    public void setCooperationMemberDao(CooperationMemberDao dao) {
        this.dao = dao;
    }
    
     @Override
    public Pager<CooperationMember> findAll(String ascProperty, boolean isAsc, int start, int limit, List<QueryCondition> entites) {
        return this.dao.findAll(ascProperty, isAsc, start, limit, entites);
    }
     
    @Override
    public void saveOrUpdate(CooperationMember data) {
        if(data != null && data.getMemberID() != null && !data.getMemberID().isEmpty()){
            if(this.dao.load(data.getMemberID()) == null){
                this.dao.save(data);
            }else{
                this.dao.update(data);
            }
        }
    }
    
    @Override
    public void delete(String cooperationID) {
        if(cooperationID != null && !cooperationID.isEmpty()){
            this.dao.delete("CooperationID", cooperationID);
        }
    }
}